// --------------------------------------查看详情功能及分配功能--------------------------------------------------------------
$.get("/typelist")
    .done(list=>{
        list.forEach(function (Sertype) {
            var opt= $("<option/>");
            opt.val(Sertype.serviceId);
            opt.text(Sertype.serviceNames);
            opt.appendTo("#See [name=leixing]");
        })
    });
$.get("/staYglist")
    .done(list=>{
        list.forEach(function (stayg) {
            var opt= $("<option/>");
            opt.val(stayg.empId);
            opt.text(stayg.empName);
            opt.appendTo("#fenpei [name=processedMan]");
        })
    });
function actionFormatter(){
    var del=`<button class="aaa btn btn-danger "><i class="glyphicon glyphicon-eye-open"></i>查看</button> `;
    var edit=`<button class="cc btn btn-warning"><i class="glyphicon glyphicon-user"></i>分配</button>`
    return del+edit;
}
var actionEvents ={
    "click .aaa":function(a,b,row){
    $("#See [name=name]").html(row.serviceName);
    $("#See [name=kehu]").html(row.customer.name);
    $("#See [name=leixing]").html(row.servicetype.serviceNames);
    $("#See [name=phone]").html(row.customer.cellphone);
    $("#See [name=neirong]").html(row.serviceContent);
    $("#See [name=beizhu]").html(row.note);
    $("#See").dialog("show");

    },
    "click .cc":function(a,b,row){
        $("#fenpei [name=serviceId]").val(row.serviceId);
        $("#fenpei [name=name]").html(row.serviceName);
        $("#fenpei [name=start]").html(row.fuwustart.fuwuleixing);
        $("#fenpei [name=leixing]").html(row.servicetype.serviceNames);
        $("#fenpei [name=chuangjianren]").html(row.staff.empName);
        $("#fenpei [name=chuangjianshijian]").html(row.lastModifyTime);
        $("#fenpei [name=daichuli]").html(row.staff.empName);
        $("#fenpei [name=neirong]").html(row.serviceContent);
        $("#fenpei").dialog("show");
    }
}
$("#See").dialog({
    title:"查看服务详情",

})
$("#fenpei").dialog({
    title:"服务分配",
    btnBind(){
        var params=$("#fenpei form").serialize();
        $.get(`${ctx}/updafenpei`,params)
            .done(msg=>{
                toastr.success(msg);
                $("#serTb").bootstrapTable("refresh");
                $("#fenpei").dialog("hide");
            });
    }
})

// -----------------------------------------以下是条件查询---------------------------------------------------
function chaxun() {
    var formParams=$("#queryForm").serialize();
    var obj=Qs.parse(formParams);
    $("#serTb").bootstrapTable("refresh",{query:obj});

}
// -----------------------------以下是条件查询绑定状态和类型下拉框的值-------------------------------------------------
$.get("/typelist")
    .done(list=>{
        list.forEach(function (Sertype) {
            var opt= $("<option/>");
            opt.val(Sertype.serviceId);
            opt.text(Sertype.serviceNames);
            opt.appendTo("#queryForm [name=fuwuid]");
        })
    });
$.get("/startlist")
    .done(list=>{
        list.forEach(function (start) {
            var opt= $("<option/>");
            opt.val(start.fuwuid);
            opt.text(start.fuwuleixing);
            opt.appendTo("#queryForm [name=serviceId]");
        })
    });


